<template>
  <div>
    <div v-for="iem in carItem" :key="iem">
      <span>{{ iem }}</span>
    </div>
    <el-button @click="show" type="success">显示子组件</el-button>
    <item-som v-if="somShow" ref="itemSom"></item-som>
  </div>
</template>

<script>
import ItemSom from "./ItemSom.vue";
export default {
  name: "item",
  components: {
    ItemSom,
  },
  data() {
    return {
      somShow: false,
    };
  },
  props: ["carItem"],
  methods: {
    show() {
      console.log("显示子组件");
      this.somShow = true;
      this.$nextTick(() => {
        console.log('子组件---',this.$refs.ItemSom);
        this.$refs.itemSom.initSom();
      });
    },
  },
};
</script>

<style>
</style>
